package com.wyclabs.commons.exception;

import com.wyclabs.commons.constants.ErrorCodes;
import lombok.Getter;
import lombok.Setter;

/**
 * 类注释
 * @author rs
 * @date 基础业务异常
 */
@Getter
@Setter
public class BaseBusinessException extends RuntimeException {

    private static final long serialVersionUID = 11481676734534L;

    /**
     * 错误码
     */
    private String code;

    /**
     * 错误消息
     */
    private String msg;

    public BaseBusinessException() {
    }

    public BaseBusinessException(String code, String msg) {
        super(msg);
        this.code = code;
        this.msg = msg;
    }

    public BaseBusinessException(ErrorCodes errorCode) {
        super(errorCode.getDescription());
        code = errorCode.getCode();
        msg = errorCode.getDescription();
    }

}
